#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3e5 + 5;
const int K = 1e6 + 6;
int n, m;
int vis[K], mnp[K];
int a[N], f[K];
void init(int n) {
  vis[1] = 1;
  for (ll i = 2; i <= n; i++) {
    if (!vis[i]) {
      mnp[i] = i;
      for (ll j = i * i; j <= n; j += i)
        if (!vis[j]) mnp[j] = i, vis[j] = 1;
    }
  }
  f[1] = 1;
  for (int i = 2; i <= n; i++) {
    int j = 0;
    int x = i;
    while (x % mnp[i] == 0) j++, x /= mnp[i];
    f[i] = (j + 1) * f[x];
  }
}
ll sum[N << 2], mx[N << 2];
void pushup(int p) {
  sum[p] = sum[p << 1] + sum[p << 1 | 1];
  mx[p] = max(mx[p << 1], mx[p << 1 | 1]);
}
void build(int p, int l, int r) {
  if (l == r) {
    sum[p] = mx[p] = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  pushup(p);
}
void update(int L, int R, int p, int l, int r) {
  if (mx[p] <= 2) return;
  if (l == r) {
    sum[p] = mx[p] = f[mx[p]];
    return;
  }
  int mid = (l + r) >> 1;
  if (L <= mid) update(L, R, p << 1, l, mid);
  if (R > mid) update(L, R, p << 1 | 1, mid + 1, r);
  pushup(p);
}
ll query(int L, int R, int p, int l, int r) {
  if (L <= l && R >= r) return sum[p];
  int mid = (l + r) >> 1;
  ll res = 0;
  if (L <= mid) res += query(L, R, p << 1, l, mid);
  if (R > mid) res += query(L, R, p << 1 | 1, mid + 1, r);
  return res;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  init(1e6);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  build(1, 1, n);
  while (m--) {
    int op, l, r;
    cin >> op >> l >> r;
    if (op == 1)
      update(l, r, 1, 1, n);
    else
      cout << query(l, r, 1, 1, n) << endl;
  }
  return 0;
}